UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gDX0ncvLZL/0o6UXdnNT0VI0oihg4htV4Z9xHGUmAXk=' 
WHERE 
  key_id = '0fc39d039735f28e48e6f23768cee5f027bd3c7af43cb412f2692adcef575150' 
  AND (
    token = 'gDX0ncvLZL/0o6UXdnNT0VI0oihg4htV4Z9xHGUmAXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036