UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X13RW5XC6poQ2siLNv/IBb/C9j75aK2kRtrICB35qT8=' 
WHERE 
  key_id = '18307d6ff5597c11ffe68d3475bbf081cd4b230e4feaf9d3a3d95a00eb1fa5d8' 
  AND (
    token = 'X13RW5XC6poQ2siLNv/IBb/C9j75aK2kRtrICB35qT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028