UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'etCO50Jc89ULnF8YkSSUz5YpcO8oMdpU88ip2ssEeZA=' 
WHERE 
  key_id = '7a6d951d2af33fc3654e110af6382d696971a286117965db983e55cc42c4a72e' 
  AND (
    token = 'etCO50Jc89ULnF8YkSSUz5YpcO8oMdpU88ip2ssEeZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038