UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jizRCWbmC9cbVfQs3bJdgvXZCBsxrMVOMqy3PTwrlaM=' 
WHERE 
  key_id = 'e29ea023c28a240b31eb1258cdd0f4ddfc4785d1b50024d72acd9ff5f4750a19' 
  AND (
    token = 'jizRCWbmC9cbVfQs3bJdgvXZCBsxrMVOMqy3PTwrlaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034