UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YcIQUXlnvs6EuYKnxsTlS8KOyFwPmmT7IOPXhvZ+ZWM=' 
WHERE 
  key_id = '5f0b4b5fc4191e6e0b8a830bef9e95d37999ef2a999aba96689d65551856291d' 
  AND (
    token = 'YcIQUXlnvs6EuYKnxsTlS8KOyFwPmmT7IOPXhvZ+ZWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028