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

Query time 0.00032