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

Query time 0.00021