UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'As+mlTiO3Mtxb3gO7QJUzu10r4z0PREuj1T/Lj09+b4=' 
WHERE 
  key_id = '334a710a090ca7f008d533ac49e161ee3d74c67aeac981074e3260d0bb0b3346' 
  AND (
    token = 'As+mlTiO3Mtxb3gO7QJUzu10r4z0PREuj1T/Lj09+b4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039