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

Query time 0.00040