UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lWflV9bHWz3quwnzR3midsmBOHBYhf+ENkfkfkvo/9s=' 
WHERE 
  key_id = '657a3a11eb81fc451c65a2d468e4c0d4b013fc05a6da049752902af2a177c65a' 
  AND (
    token = 'lWflV9bHWz3quwnzR3midsmBOHBYhf+ENkfkfkvo/9s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043