UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z9wZEPbzYaCgiDRN9UCxWvdz3PNOV1OMavNjmsWL8SQ=' 
WHERE 
  key_id = '8cdbe4c0b03d1363d0d8571ccf4cd52a7a83afafebd429c41567edd186f27f32' 
  AND (
    token = 'Z9wZEPbzYaCgiDRN9UCxWvdz3PNOV1OMavNjmsWL8SQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020