UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lN6s3h5UQfGcG90CnI0SRkXaTzBGTpq9VxDxwaBuGMg=' 
WHERE 
  key_id = '4fb2e62a03e69fc14694d7a48174f3060a9f771b8a013296cfc8762b2ef321c0' 
  AND (
    token = 'lN6s3h5UQfGcG90CnI0SRkXaTzBGTpq9VxDxwaBuGMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052