UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wHaNCNxxCxuN249cWQngBiH4uwU0T1Es4vYQMz6Oh/8=' 
WHERE 
  key_id = '5b1134161e1394d42b483e2f2c020e5a11e49f421ada20702c814b2283e4da6f' 
  AND (
    token = 'wHaNCNxxCxuN249cWQngBiH4uwU0T1Es4vYQMz6Oh/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046