UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C2KoIrIn1PjTeTguhutqIMdpp45kj73CP9NBtwYltvQ=' 
WHERE 
  key_id = '3cb0cbd44ec98605a18e7b97f00379cf5d078cff0ae2ab31449d361daa22027b' 
  AND (
    token = 'C2KoIrIn1PjTeTguhutqIMdpp45kj73CP9NBtwYltvQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048