UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y3s4bY2eb6Rf4I0sqlZUQSFy+ybLdV+VfuECQIJ2QSQ=' 
WHERE 
  key_id = 'ce5399e6393ab93dcf31d8cb0042dd46982130bbb7e37da13d831b5534de55bb' 
  AND (
    token = 'Y3s4bY2eb6Rf4I0sqlZUQSFy+ybLdV+VfuECQIJ2QSQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042