UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ftq4IQPVTVORHH35ZfiwXH4c3xP+BisYThgRec7RtOM=' 
WHERE 
  key_id = '1a3070c09c76853edeb3160da538de2b7f31f82d22397c33510af6d5f20b8d2c' 
  AND (
    token = 'ftq4IQPVTVORHH35ZfiwXH4c3xP+BisYThgRec7RtOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041