UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TB1XwCeM3RuD7kPkiDcbSeGy0ij+IzzlbF/ns5y2ElM=' 
WHERE 
  key_id = '4b48b7ed87b95cee5e9bab1a9eb5439e8ba5641ca8746e3fbba01e61634d3eda' 
  AND (
    token = 'TB1XwCeM3RuD7kPkiDcbSeGy0ij+IzzlbF/ns5y2ElM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037