UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QNe36vevWTJj5XDWysOQSyon9WPI8BX0n/hTjXaxK8E=' 
WHERE 
  key_id = '6d811e76999f916a493a3faa8eef9f40101647bfbaa456e3c33bc2d6319b231d' 
  AND (
    token = 'QNe36vevWTJj5XDWysOQSyon9WPI8BX0n/hTjXaxK8E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031