UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SDWOy2wSSwN8eXTgmLJoXf8JZEpG1avQB4VmfbuTZkw=' 
WHERE 
  key_id = '30e338aec4833d286b26c06a2401649779a4d61e37775d84d23ce0230ebe3866' 
  AND (
    token = 'SDWOy2wSSwN8eXTgmLJoXf8JZEpG1avQB4VmfbuTZkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026