UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '44ncfb6YY5TxfUTcSE5rftIgPxmO7pZj2GUHIypGNLY=' 
WHERE 
  key_id = 'd6e2683bdfe83beac27df58367988b487757a881f359171612b4680cf8e11950' 
  AND (
    token = '44ncfb6YY5TxfUTcSE5rftIgPxmO7pZj2GUHIypGNLY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040