UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TrQP3qHOFlm34ReVtxHf3+2TmaaN9OIxEq1Jf4buQBI=' 
WHERE 
  key_id = '5ded88e246eb2b7550f59a17cfb873ec76a283bd43590cdb04897c332c610d99' 
  AND (
    token = 'TrQP3qHOFlm34ReVtxHf3+2TmaaN9OIxEq1Jf4buQBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046