UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dzOe7jGqIHwhZuaTryUfxLxM5T6NCJtE8gjHU06C/x8=' 
WHERE 
  key_id = '3878b40393a29ea1c393e517027f99ed12acc778df871791cff113bf34a9225f' 
  AND (
    token = 'dzOe7jGqIHwhZuaTryUfxLxM5T6NCJtE8gjHU06C/x8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049