UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ecGXH0TVnf8rM3OS0NntbS/rrfAdf2v6Fq9EMJN4sfg=' 
WHERE 
  key_id = 'a633229668bda48f1223792a586ad47a3200684414c4c6b4a2c0c953380c91b6' 
  AND (
    token = 'ecGXH0TVnf8rM3OS0NntbS/rrfAdf2v6Fq9EMJN4sfg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054