UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0j54LBe2IkRBpeTL0U4sLr4F6XioRj5n2V98kga4D3s=' 
WHERE 
  key_id = 'a9d604a8ccabd6e29e58baec3338d1a6e8accb5c13624559f19342b0b88bdd61' 
  AND (
    token = '0j54LBe2IkRBpeTL0U4sLr4F6XioRj5n2V98kga4D3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050