UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vT/AG2zk62xeBAjvfcZezu2L311VU/xh3oqmvWBgoxo=' 
WHERE 
  key_id = '2a49e6b4c99a41e5697bfd5b74e3974707317e887c9ac6b16719ef571e393de2' 
  AND (
    token = 'vT/AG2zk62xeBAjvfcZezu2L311VU/xh3oqmvWBgoxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038