UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nuf/URHDXWx1eZTd+s84EmwDJtAKdlIFhMhOCap+Jjo=' 
WHERE 
  key_id = '78a3cf64600d3e4b525acae31626169e52348a8f6aa3b825e5e34c41e297a4ed' 
  AND (
    token = 'nuf/URHDXWx1eZTd+s84EmwDJtAKdlIFhMhOCap+Jjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034