UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iR6egyY1cQ/1y/aX3dXn4F3nTlwc+ASS9gqp+2muvZA=' 
WHERE 
  key_id = '673ccf45d4eee8d052dc8ef155d679b122c5ee50f04162dfff18ce4ff536854f' 
  AND (
    token = 'iR6egyY1cQ/1y/aX3dXn4F3nTlwc+ASS9gqp+2muvZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027