UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rtPdL2Qc9yyypjzNPP/hNdTxSRfyYQ0Bk1EgCSG0+lc=' 
WHERE 
  key_id = '2967c5915589cf3522835f446d1a8b5c69f6a54a6b63d9325f22a69341c48662' 
  AND (
    token = 'rtPdL2Qc9yyypjzNPP/hNdTxSRfyYQ0Bk1EgCSG0+lc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021