UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NQ8RDlgLfXmDbG7Brbq0Lo6aBNgGfl6PaUXxVV1pvpY=' 
WHERE 
  key_id = '151b3d1b1059d0d48c587332fadc51c5004079ff2ae7849cd6a67cf19813ed96' 
  AND (
    token = 'NQ8RDlgLfXmDbG7Brbq0Lo6aBNgGfl6PaUXxVV1pvpY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051