UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DahMzb9kyBg/xHf2mXDgD1i2HExDwurxX6PGVke0NBk=' 
WHERE 
  key_id = '0d91979e7dcdacc7181fb8b400dc7c774fcea0ec82de89c16e254a6914052bbf' 
  AND (
    token = 'DahMzb9kyBg/xHf2mXDgD1i2HExDwurxX6PGVke0NBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038