UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZleNYud3iGW/DiA8ol293nXkwhByHUTZl0Wrp+Qf2hM=' 
WHERE 
  key_id = 'ab439a0164c9a95cbf24124fc37952235746cd94aedb4dde85090f113ff4f178' 
  AND (
    token = 'ZleNYud3iGW/DiA8ol293nXkwhByHUTZl0Wrp+Qf2hM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035