UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lkAwJzlMIsrhr6eHr1Qt1yBB8sKlRnJTEqPXVPsRzlI=' 
WHERE 
  key_id = 'bd1f1869b8b2d6b4c0c5cffdfecf3307585651737c9d992deb0a37765c3b7357' 
  AND (
    token = 'lkAwJzlMIsrhr6eHr1Qt1yBB8sKlRnJTEqPXVPsRzlI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038