UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'clzBut4hK26kXSa1AHyaPMDrBBjndd7qtwb5maL+KVs=' 
WHERE 
  key_id = '970b0673ce60d4857939126256fdb785d108190152b58e584cc2dd17ab2fcd03' 
  AND (
    token = 'clzBut4hK26kXSa1AHyaPMDrBBjndd7qtwb5maL+KVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048