UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R9kiTdoy71+8vx0IZsuc4MQUEFXGYfZT4kQqEkFd41M=' 
WHERE 
  key_id = 'fece266d9a1bc5cd6fa734fb200c56265dc2447e56d51550a43d39cc8ad7221e' 
  AND (
    token = 'R9kiTdoy71+8vx0IZsuc4MQUEFXGYfZT4kQqEkFd41M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031