UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OXulm5xu/DltdmXcp+7m+6lZZAg+eeSUsMz2ETbcopA=' 
WHERE 
  key_id = '79617cb47232a246670ada350fa3db766980e4b200601e1aecce0b9416cd464b' 
  AND (
    token = 'OXulm5xu/DltdmXcp+7m+6lZZAg+eeSUsMz2ETbcopA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037